package com.codejam.hello.world.controller;

import com.codejam.hello.world.model.Student;
import com.codejam.hello.world.model.Teacher;
import com.codejam.hello.world.service.impl.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RequestMapping(value = "/test")
@RestController
public class TestController {

    @Autowired
    private TestService testService;


    @RequestMapping(value = "/test1", method = RequestMethod.POST)
    public String test1(@RequestBody @Valid Student req) {

        testService.aaa();
        return req.toString();
    }

    @RequestMapping(value = "/test2", method = RequestMethod.POST)
    public String test2(@RequestBody @Valid Teacher req) {

        return req.toString();
    }


}
